package com.fanqie.springboot2.controller;

import com.fanqie.springboot2.entity.User;
import com.fanqie.springboot2.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author php
 * @date 2019/3/31
 */
@RestController
@RequestMapping("/user")
public class UserController {
    /**
     * 注入userMapper
     */
    private final UserMapper userMapper;

    @Autowired
    public UserController(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    @GetMapping("/all")
    public List<User> selectAll(){
        return this.userMapper.selectAll();
    }
}
